package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.reporting.entity.CmInteCoCustInfo;
import com.jrx.anytxn.reporting.mapper.base.CmInteCoCustInfoMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @comment: 零售客户信息数据报表Writer
 * @author: hsoong
 * @date: 2021/7/1 14:04
 */
@Service
public class CustInfoReportingWriter implements ItemWriter<CmInteCoCustInfo> {

    private static Logger logger = LoggerFactory.getLogger(CustInfoReportingWriter.class);

    @Resource
    CmInteCoCustInfoMapper cmInteCoCustInfoMapper;

    @Override
    public void write(List<? extends CmInteCoCustInfo> list) throws Exception {
        logger.info("本次数据写入条数: {}", list.size());

        for (CmInteCoCustInfo item : list) {
            cmInteCoCustInfoMapper.insertSelective(item);
        }
    }

}
